package com.java.module.fire.service.impl;

import java.util.List;
import com.java.common.utils.DateUtils;
import com.java.module.fire.domain.UserCount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.java.module.fire.mapper.CommentMapper;
import com.java.module.fire.domain.Comment;
import com.java.module.fire.service.ICommentService;

/**
 * 帖子评论Service业务层处理
 * 
 * @author Administrator
 * @date 2025-02-10
 */
@Service
public class CommentServiceImpl implements ICommentService {
    @Autowired
    private CommentMapper commentMapper;

    /**
     * 查询帖子评论
     * 
     * @param commentId 帖子评论ID
     * @return 帖子评论
     */
    @Override
    public Comment selectCommentById(Long commentId) {
        return commentMapper.selectCommentById(commentId);
    }

    /**
     * 查询帖子评论
     *
     * @param comment 帖子评论
     * @return 帖子评论
     */
    @Override
    public Comment selectCommentOne(Comment comment) {
        return commentMapper.selectCommentOne(comment);
    }

    /**
     * 查询帖子评论列表
     * 
     * @param comment 帖子评论
     * @return 帖子评论
     */
    @Override
    public List<Comment> selectCommentList(Comment comment) {
        return commentMapper.selectCommentList(comment);
    }

    /**
     * 新增帖子评论
     * 
     * @param comment 帖子评论
     * @return 结果
     */
    @Override
    public int insertComment(Comment comment) {
        comment.setCreateTime(DateUtils.getNowDate());
        return commentMapper.insertComment(comment);
    }

    /**
     * 修改帖子评论
     * 
     * @param comment 帖子评论
     * @return 结果
     */
    @Override
    public int updateComment(Comment comment) {
        comment.setUpdateTime(DateUtils.getNowDate());
        return commentMapper.updateComment(comment);
    }

    /**
     * 批量删除帖子评论
     * 
     * @param commentIds 需要删除的帖子评论ID
     * @return 结果
     */
    @Override
    public int deleteCommentByIds(Long[] commentIds) {
        return commentMapper.deleteCommentByIds(commentIds);
    }

    /**
     * 删除帖子评论信息
     * 
     * @param commentId 帖子评论ID
     * @return 结果
     */
    @Override
    public int deleteCommentById(Long commentId) {
        return commentMapper.deleteCommentById(commentId);
    }

    @Override
    public UserCount selectCount(Long loginUserId) {
        return commentMapper.selectCount(loginUserId);
    }
}
